package utils.bobo.com.boboutils.App.appwidget;

import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.widget.RemoteViews;

import utils.bobo.com.boboutils.R;

/**
 * Implementation of App Widget functionality.
 */
public class CustomViewAppWidget extends AppWidgetProvider {

        static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
        int appWidgetId) {

            CharSequence widgetText = context.getString(R.string.appwidget_text);
            // Construct the RemoteViews object
            RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.custom_view_app_widget);
            views.setTextViewText(R.id.appwidget_text, widgetText);
            // Instruct the widget manager to update the widget
            appWidgetManager.updateAppWidget(appWidgetId, views);
        }

        @Override
        public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
            UpdateAppWidgetService.startActionUpdateAppWidget(context);
            super.onUpdate(context, appWidgetManager, appWidgetIds);
        }

        @Override
        public void onEnabled(Context context) {
            // Enter relevant functionality for when the first widget is created
        }

    @Override
    public void onDisabled(Context context) {
        // Enter relevant functionality for when the last widget is disabled
    }
}

